<?php

class Application_Model_ExplicitCatanTypeModel {

    protected $_id;
    protected $_name;
    protected $_has_street;
    protected $_has_knight;
    protected $_players;
    protected $_points;
    protected $_info;

    public function __construct($options = null) {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }

    public function setOptions(array $options) {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
    }

    public function __get($name) {
        $method = 'get' . ucfirst($name);
        if ('mapper' == $name || !method_exists($this, $method)) {
            throw new Exception("Ungueltige Getter-Methode fuer Eigenschaft '$method'");
        }
        return $this->$method();
    }

    public function __set($name, $value) {
        $method = 'set' . ucfirst($name);
        if ('mapper' == $name || !method_exists($this, $method)) {
            throw new Exception("Ungueltige Setter-Methode fuer Eigenschaft '$name'");
        }
        return $this->$method($value);
    }

    public function getMapper() {
        if (null === $this->_mapper) {
            $this->_mapper = new Application_Model_ExplicitCatanTypeMapper();
        }
        return $this->_mapper;
    }

    public function setMapper($mapper) {
        $this->_mapper = $mapper;
        return $this;
    }

    public function getId() {
        return $this->_id;
    }

    public function setId($value) {
        $this->_id = (int) $value;
        return $this;
    }

    public function getName() {
        return $this->_name;
    }

    public function setName($value) {
        $this->_name = (string) $value;
        return $this;
    }

    public function getHas_street() {
        return $this->_has_street;
    }

    public function setHas_street($value) {
        $this->_has_street = (int) $value;
        return $this;
    }

    public function getHas_knight() {
        return $this->_has_knight;
    }

    public function setHas_knight($value) {
        $this->_has_knight = (int) $value;
        return $this;
    }

    public function getPlayers() {
        return $this->_players;
    }

    public function setPlayers($value) {
        $this->_players = (string) $value;
        return $this;
    }

    public function getPoints() {
        return $this->_points;
    }

    public function setPoints($value) {
        $this->_points = (int) $value;
        return $this;
    }

    public function getInfo() {
        return $this->_info;
    }

    public function setInfo($value) {
        $this->_info = (string) $value;
        return $this;
    }

}

